import { FormSchema } from '@/components/Form';
import { sexTypeOption, roleTypeOption } from '@/views/user/help/dict';
import { getAuthCache } from '@/utils/auth';
import { USER_INFO_KEY } from '@/enums/cacheEnum';

const userInfo = getAuthCache(USER_INFO_KEY);
console.log(userInfo,'每次打开');


export interface ListItem {
  key: string;
  title: string;
  description: string;
  extra?: string;
  avatar?: string;
  color?: string;
}

// tab的list
export const settingList = [
  {
    key: '1',
    name: '基本设置',
    component: 'BaseSetting',
  },
  {
    key: '2',
    name: '安全设置',
    component: 'SecureSetting',
  },
];

// 基础设置 form
export const baseSetschemas: FormSchema[] = [
  {
    field: 'id',
    component: 'Input',
    label: 'ID',
    colProps: {
      span: 20,
    },
    componentProps: {
      disabled: true,
    },
    ifShow: false,
  },
  // {
  //   field: 'userName',
  //   component: 'Input',
  //   label: '账号',
  //   colProps: {
  //     span: 20,
  //   },
  //   rules: [{ required: true, message: '账号不能为空' }],
  // },
  {
    field: 'name',
    component: 'Input',
    label: '昵称',
    colProps: {
      span: 20,
    },
  },
  // {
  //   field: 'pwd',
  //   component: 'StrengthMeter',
  //   label: '密码',
  //   colProps: {
  //     span: 20,
  //   },
  //   rules: [{ required: true, message: '密码不能为空' }],
  // },
  {
    field: 'sex',
    component: 'Select',
    label: '性别',
    colProps: {
      span: 20,
    },
    componentProps: {
      options: sexTypeOption,
    },
  },
  {
    field: 'type',
    component: 'RadioGroup',
    label: '角色',
    colProps: {
      span: 20,
    },
    componentProps: {
      options: roleTypeOption,
      disabled: true,
    },
    rules: [{ required: true, message: '角色不能为空' }],
  },
  // {
  //   field: 'phone',
  //   component: 'InputNumber',
  //   label: '手机号',
  //   colProps: {
  //     span: 20,
  //   },
  // },
  {
    field: 'age',
    component: 'InputNumber',
    label: '年龄',
    colProps: {
      span: 20,
    },
  },
  {
    field: 'height',
    component: 'InputNumber',
    label: '身高',
    colProps: {
      span: 20,
    },
    componentProps: {
      addonAfter: 'cm',
    },
  },

  {
    field: 'weight',
    component: 'InputNumber',
    label: '体重',
    colProps: {
      span: 20,
    },
    componentProps: {
      addonAfter: 'kg',
    },
  },
];

// 安全设置 list
export const secureSettingList: ListItem[] = [
  {
    key: '1',
    title: '账户密码',
    description: `当前密码：：${(userInfo as any).pwd}`,
    extra: '修改',
  },
  {
    key: '2',
    title: '密保手机',
    description: `已绑定手机：：${(userInfo as any).phone || '未绑定'}`,
    extra: '修改',
  },
  // {
  //   key: '3',
  //   title: '密保问题',
  //   description: '未设置密保问题，密保问题可有效保护账户安全',
  //   extra: '修改',
  // },
  // {
  //   key: '4',
  //   title: '备用邮箱',
  //   description: '已绑定邮箱：：test@test.com',
  //   extra: '修改',
  // },
  // {
  //   key: '5',
  //   title: 'MFA 设备',
  //   description: '已绑定iphone20promax',
  //   extra: '修改',
  // },
];

// 账号绑定 list
export const accountBindList: ListItem[] = [
  {
    key: '1',
    title: '绑定淘宝',
    description: '当前未绑定淘宝账号',
    extra: '绑定',
    avatar: 'ri:taobao-fill',
    color: '#ff4000',
  },
  {
    key: '2',
    title: '绑定支付宝',
    description: '当前未绑定支付宝账号',
    extra: '绑定',
    avatar: 'fa-brands:alipay',
    color: '#2eabff',
  },
  {
    key: '3',
    title: '绑定钉钉',
    description: '当前未绑定钉钉账号',
    extra: '绑定',
    avatar: 'ri:dingding-fill',
    color: '#2eabff',
  },
];

// 新消息通知 list
export const msgNotifyList: ListItem[] = [
  {
    key: '1',
    title: '账户密码',
    description: '其他用户的消息将以站内信的形式通知',
  },
  {
    key: '2',
    title: '系统消息',
    description: '系统消息将以站内信的形式通知',
  },
  {
    key: '3',
    title: '待办任务',
    description: '待办任务将以站内信的形式通知',
  },
];
